import React from "react";

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      count: 0,
    };
    console.log('constructor调用');
    
  }
  componentDidMount(){
    console.log("组件挂载");
  }
  componentWillUnmount(){
    console.log("组件卸载");
  }
  componentDidUpdate(){
    console.log("组件更新");
  }
  addCount(){
    this.setState({
      count:this.state.count+1
    })
  }
  render() {
    console.log('render调用');
    return (
        <div>
            <span>{this.state.count}</span>
            <button onClick={() => this.addCount()}>+</button>
        </div>
    );
  }
}
